Skip to content

Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies#1051

Open
SkyLexS wants to merge 37 commits into
nf-core:devfrom
SkyLexS:deep_mased_imp
Open

Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies#1051
SkyLexS wants to merge 37 commits into
nf-core:devfrom
SkyLexS:deep_mased_imp

Conversation

@SkyLexS

@SkyLexS SkyLexS commented Jun 17, 2026

Copy link
Copy Markdown

PR checklist

  • DeepMAsED features extracts alignment-based statistics from a BAM file and assembly FASTA to produce per-contig feature tables, which are then consumed by DeepMAsED predict to assign each contig a misassembly score between 0 (correctly assembled) and 1 (likely misassembly) using a pre-trained neural network.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/mag branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@nf-core-bot

Copy link
Copy Markdown
Member

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 3.5.2.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the nf-core documentation and Synchronisation documentation.

@jfy133 jfy133 changed the title Deep mased imp Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies Jun 18, 2026

@jfy133 jfy133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial pass, but I leave the proper review to @dialvarezs :)

Comment thread conf/modules.config Outdated
Comment thread conf/modules.config Outdated
Comment thread conf/modules.config Outdated
Comment thread conf/modules.config Outdated
Comment thread docs/usage.md Outdated
Comment thread workflows/mag.nf Outdated
Comment thread workflows/mag.nf Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
SkyLexS and others added 3 commits June 21, 2026 02:26
… the nftignore because deepmased uses Deep Learning TensorFlow and when you run predictions for the same input the output could be of by one decimal and fail the test
@jfy133

jfy133 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Still have test various failures due to variation in the snapshot...

@dialvarezs dialvarezs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SkyLexS! Sorry for the delay.

Your PR looks clean, I have just a few comments. Some will need an nf-core module update, not just pipeline code.

Additionally, I would prefer to make this an opt-in feature rather than opt-out. We already run ALE by default, DeepMAsED seems to be noticeably heavier (the default CI profile went from ~30 min to ~1 h), and I don't think most users will make good use of contig misassembly scores anyway. We can leave it enabled on only one testing profile to trigger it in ci, assembly_input seems a good option for this.

Another concern: --skip_deepmased_features is redundant, per your validation, skipping features forces skipping predict, which equals --skip_deepmased. Only "features only" is a real sub-case, but is that case actually useful? If not, then we should only keep a single flag to control the execution of the tool.

I reverted the out-of-scope changes, looks like they came from trying to stabilize snapshots and/or merging the newer changes on dev, but they weren't necessary.
There's a single GTDB-Tk file failing the checksum, I will look into that to see if we can just ignore it or needs a fix.

EDIT: All snapshots are stable now.

Comment thread conf/modules.config
}

withName: DEEPMASED_FEATURES {
ext.args = { params.deepmased_features_gzip ? '--gzip' : '' }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming --gzip appends .gz to the feats files, enabling this flag will make DEEPMASED_FEATURES fail, because the module only declares path("*_feats.tsv"), so Nextflow won't find the output. Supporting the flag needs an update to the nf-core module to match the compressed extension (*_feats.tsv{,.gz}).

Comment thread nextflow.config
skip_deepmased = false
skip_deepmased_features = false
skip_deepmased_predict = false
deepmased_cpu_only = true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of flags turned on by default. Let's make it deepmased_use_gpu instead.

Comment thread workflows/mag.nf

if (!params.skip_deepmased && !params.skip_binning) {
ch_shortread_assemblies_for_deepmased = ch_assemblies.filter { meta, _assembly ->
meta.sr_platform != null && meta.sr_platform != []

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter ch_assemblies.filter { meta -> meta.sr_platform != null && meta.sr_platform != [] } selects by read presence, not assembler. In hybrid samples the Flye/metaMDBG assemblies also carry sr_platform, so they pass the filter and get joined with their long-read BAM, then DeepMAsED ends up running on a long-read alignment, likely unintended.

It also keeps SPAdesHybrid. The output.md note says hybrid isn't supported. To be honest, I'm not an expert on these tools, but we already run ALE on hybrid. Either way, pick the channel by assembler like ALE:

  • Hybrid OK (matches ALE): use ch_shortread_assemblies (keeps MEGAHIT/SPAdes/SPAdesHybrid, drops Flye/metaMDBG) + fix the output.md line.
  • Exclude hybrid: filter ch_shortread_assemblies to meta.assembler in ['MEGAHIT','SPAdes'], keep docs.

@@ -0,0 +1,38 @@
process DEEPMASED_PREDICT {
tag "$meta.id"
label 'process_medium'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reliably request GPUs (especially on HPC/cloud executors), this module needs the process_gpu label. That wires it to the accelerator directive under -profile gpu.

Comment thread workflows/mag.nf
================================================================================
*/

if (!params.skip_binning || params.ancient_dna || !params.skip_ale) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add deepmased here too, because if not, enabling skip_binning will skip it silently.

Comment thread docs/output.md

- `Assembly/[assembler]/QC/[sample/group]/DeepMAsED/features/`
- `[sample]-[assembler]_feature_file_paths.tsv`: Index file listing all generated feature table files
- `[sample]-[assembler]*_feats.tsv`: Per-contig feature tables (one per parallel processing bin)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have {,.gz} to consider deepmased_features_gzip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants